package cn.sanli.manage.mapper.data1;
import org.apache.ibatis.annotations.Param;

import cn.sanli.manage.pojo.entity.Organization;
import cn.sanli.manage.pojo.vo.DeptNameVO;
import cn.sanli.manage.pojo.vo.RegionNameVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @version 1.0.0
 * @program: award-punish
 * @description: TODO
 * @author: lsk
 * @create: 2023-12-04 15:52
 * @since jdk1.8
 **/
@Mapper
public interface OrganizationMapper extends BaseMapper<Organization> {
    Organization selectByPrimaryKey(Integer id);

    void update(Organization organization);

    int deleteByPrimaryKey(Integer id);

    /**
     * 查询所有大区
     * @return
     */
    List<RegionNameVO> regionName();

    /**
     * 根据大区查询对应部门
     */
    List<DeptNameVO> deptName(int id);

    Organization selectCenterByName(@Param("name") String name);

    Organization selectDeptByName(@Param("name") String name, @Param("parentId") Integer parentId);

    //查询全部大口和部门
    List<Organization> selectAll();

    //添加组织结构
    void insertAll(Organization organization);

    //修改组织结构
    void updateSelective(Organization organization);

    //查询子节点个数
    int countByParentId(@Param("parentId") Integer parentId);

    //删除组织结构
    void updateIsDeleteById(@Param("id") Integer id);
}